{
	template:`
	<a-page-header title="设置权限">
		<template #extra>
			<m-back @click="back(false);">关闭</m-back>
		</template>
		<a-card :bodyStyle="{padding:'0'}" :hoverable="true">
			<a-list :data-source="list">
				<template #renderItem="{ item }">
					<a-list-item>
                        <a-switch v-model:checked="power[item.key]" @change="onchange(item.key)" />
                        &nbsp;&nbsp;&nbsp;&nbsp;{{item.name}}
                        <small>{{item.desc}}</small>
					</a-list-item>
				</template>
			</a-list>
		</a-card>
	</a-page-header>
	`,
	props: ['localeZh','param','parentVue'],
	data:function(){
		return {
			list:[],
			power:{}
		};
	},
	mounted(){
		this.requestData("action/manage/adminGroupPower/getAllAdminGroupPower",
			{groupOid:this.param.groupOid},
			function(json){
				if(json.code==0){
					for(var i=0;i<json.list.length;i++){
						var arr=json.list[i][1].split("|");
						this.list.push({key:json.list[i][0],name:arr[0],desc:arr[1]});
					}
					this.power=json.power;
				}else{
					this.remind().error(data.msg);
				}
			}.bind(this)
		);
	},
	methods:{
		onchange:function(key){
			var flag=this.power[key];
			var method=flag?"addAdminGroupPower":"removeAdminGroupPower";
			this.requestData("action/manage/adminGroupPower/"+method,
				{model:{adminGroup:{oid:this.param.groupOid},name:key}},
				function(data){
					if(data.code!=0){
						this.power[key]=!flag;
						this.remind().error(data.msg);
					}else{
						this.remind().success(data.msg);
					}
				}.bind(this)
			);
		},
	}
}